<?php
/*
* Copyright (c) 2010 by Cediti
*
* You may distribute under the terms of either the GNU Lesser General
* Public License or the new BSD License, as specified in the README file.
*/

/**
 * ID type for object, Repository, ...
 * 
 * It's overall a wrapper class
 * 
 */
class Cmis_Repository_Id
{
	protected $_id;

	/**
	 *
	 * @param string $id
	 */
	public function __construct($id = '')
	{
		if (!empty($id))
		{
			$this->setId($id);
		}
	}

	public function __isset($name = '')
	{
		return $this->isEmpty();
	}

	public function isEmpty()
	{
		return empty($this->_id);
	}

	/**
	 * Define the id of the repository
	 * @param string $id
	 * @return void
	 */
	public function setId($id)
	{
		$this->_id = $id;
	}

	/**
	 * Set the id of the repository
	 * @return string
	 */
	public function getId()
	{
		return $this->_id;
	}

	public function __toString()
	{
		if ($this->isEmpty())
		{
			return '';
		}
		return $this->getId();
	}
}

# EOF
